package com.yupi.yuaicodemother.model.enums;

import lombok.Getter;

@Getter
public enum UserRoleEnum {

    USER("用户","user"),
    ADMIN("管理员","admin");


    private String text;
    private String value;

    UserRoleEnum(String text, String value) {
        this.text = text;
        this.value = value;
    }


    // 根据value获取枚举
    public static UserRoleEnum getEnumByValue(String value) {
        for (UserRoleEnum anEnum : UserRoleEnum.values()) {
            if (anEnum.getValue().equals(value)) {
                return anEnum;
            }
        }
        return null;
    }
}
